#include "songitem.h"
#include "ui_songitem.h"

SongItem::SongItem(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::SongItem)
{
    ui->setupUi(this);
}

SongItem::~SongItem()
{
    delete ui;
}

void SongItem::SetSong(QString sn, QString an, QString ct, bool v, bool s,bool lk)
{
    ui->songname->setText(sn);
    ui->author->setText(an);
    if(v)
        ui->infoVip->setPixmap(QPixmap(":/images/VIP.png"));
    if(s)
        ui->infoSQ->setPixmap(QPixmap(":/images/sq.png"));
    setLikeIcon(lk);
    ui->collection->setText(ct);
}

void SongItem::setMusicName(QString name)
{
    ui->songname->setText(name);
}

void SongItem::setSinger(QString singer)
{
    ui->author->setText(singer);
}

void SongItem::setAlbumName(QString albumName)
{
    ui->collection->setText(albumName);
}

void SongItem::setLikeIcon(bool like)
{
    if(like)
        ui->like->setIcon(QPixmap(":/images/like_2.png"));
    else
        ui->like->setIcon(QPixmap(":/images/like_1.png"));
}

void SongItem::on_like_clicked()
{
    islike =!islike;
     setLikeIcon( islike);
    emit likeChange(islike);
}

